package net.zdreamer.shunyi.ui;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.TextView;

import net.zdreamer.shunyi.R;
import net.zdreamer.shunyi.utils.ViewControlor;
import net.zdreamer.shunyi.utils.WindowUtil;

public class SocialActivity extends Activity implements AdapterView.OnItemClickListener {

    private GridView gridView;
    private Adapter mAdapter;
    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_social);
        init();
    }

    private void init() {
        ((TextView) findViewById(R.id.title_content)).setText("交友");
        ((TextView) findViewById(R.id.title_content)).setTextColor(0xffffffff);
        findViewById(R.id.leftimg).setBackgroundResource(R.drawable.backimg);
        findViewById(R.id.title_item).setBackgroundResource(R.drawable.photo_back);
        gridView = (GridView) findViewById(R.id.gridview_photo);
        gridView.setOnItemClickListener(this);
        gridView.setAdapter(new BaseAdapter() {
            @Override
            public int getCount() {
                return 25;
            }

            @Override
            public Object getItem(int position) {
                return null;
            }

            @Override
            public long getItemId(int position) {
                return 0;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                if (convertView == null) {
                    convertView = LayoutInflater.from(SocialActivity.this).inflate(R.layout.photo_item, null);
                }
                View v = convertView.findViewById(R.id.image_phote);
                v.setBackgroundResource(R.drawable.friend);
                ViewGroup.LayoutParams lp = v.getLayoutParams();
                lp.height = (WindowUtil.getWindowSize(SocialActivity.this).x - 16) / 3;
                v.setLayoutParams(lp);
                return convertView;
            }
        });
    }


    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            intent = new Intent(this, JiaoYouActivity.class);
            startActivity(intent);

    }
}
